﻿/*
 *
 * @author
 * @version
 */
import com.mixmedia.motion.MotionTween;

class gui.NavDesc extends MovieClip {
	private var decoMotion0;
	private var decoMotion1;
	private var decoMotion2;
	private var decoMotion3;
	private var mcDeco0;
	private var mcDeco1;
	private var mcDeco2;
	private var mcDeco3;
	private var txtMotion;
	private var mcTxt;
	private var decoInitXPos:Array;
	
	public function NavDesc(){
		mcTxt._alpha = 0;
		//txtMotion = new MotionTween(mcTxt,{dur:10});
		decoInitXPos = [-67,-47,-27,-7];
		decoMotion0 = new MotionTween(mcDeco0,{dur:10,tweenDelay:0,tweenMethod:mx.transitions.easing.Strong.easeInOut});
		decoMotion1 = new MotionTween(mcDeco1,{dur:10,tweenDelay:100,tweenMethod:mx.transitions.easing.Strong.easeInOut});
		decoMotion2 = new MotionTween(mcDeco2,{dur:10,tweenDelay:200,tweenMethod:mx.transitions.easing.Strong.easeInOut});
		decoMotion3 = new MotionTween(mcDeco3,{dur:10,tweenDelay:300,tweenMethod:mx.transitions.easing.Strong.easeInOut});
		txtMotion = new MotionTween(mcTxt,{dur:10});
		
	}
	
	public function show(arg){
		var tfm = mcTxt.txt.getTextFormat();

		mcTxt.createTextField('txf',100,0,0,0,0);
		mcTxt.txf.embedFonts = true;
		mcTxt.txf.autoSize = "right";
		mcTxt.txf.text = _root.xmlNavData.firstChild.childNodes[Number(arg)].attributes.description;
		mcTxt.txf.setTextFormat(tfm);
		var txtW = mcTxt.txf.textWidth +10;

		for(var i=0;i<4;i++){
			this['decoMotion'+i].startTween({x:decoInitXPos[i]-txtW});
		}
		txtMotion.startTween({a:100});
	}
	
	public function hide(arg){
		for(var i=0;i<4;i++){
			this['decoMotion'+i].startTween({x:decoInitXPos[i]});
		}
		txtMotion.startTween({a:0});
	}
}